package com.yulang.common.pojo.goods;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 商品类目
 * </p>
 *
 * @author Administrator
 * @since 2019-12-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_category")
public class Category implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 分类ID
     */
    @TableId(value = ID, type = IdType.AUTO)
    private Integer id;

    /**
     * 分类名称
     */
    @TableField(NAME)
    private String name;

    /**
     * 商品数量
     */
    @TableField(GOODS_NUM)
    private Integer goodsNum;

    /**
     * 是否显示
     */
    @TableField(IS_SHOW)
    private String isShow;

    /**
     * 是否导航
     */
    @TableField(IS_MENU)
    private String isMenu;

    /**
     * 排序
     */
    @TableField(SEQ)
    private Integer seq;

    /**
     * 上级ID
     */
    @TableField(PARENT_ID)
    private Integer parentId;

    /**
     * 模板ID
     */
    @TableField(TEMPLATE_ID)
    private Integer templateId;


    public static final String ID = "`id`";

    public static final String NAME = "`name`";

    public static final String GOODS_NUM = "`goods_num`";

    public static final String IS_SHOW = "`is_show`";

    public static final String IS_MENU = "`is_menu`";

    public static final String SEQ = "`seq`";

    public static final String PARENT_ID = "`parent_id`";

    public static final String TEMPLATE_ID = "`template_id`";


    public static final String ID_COMMENT = "分类ID";

    public static final String NAME_COMMENT = "分类名称";

    public static final String GOODS_NUM_COMMENT = "商品数量";

    public static final String IS_SHOW_COMMENT = "是否显示";

    public static final String IS_MENU_COMMENT = "是否导航";

    public static final String SEQ_COMMENT = "排序";

    public static final String PARENT_ID_COMMENT = "上级ID";

    public static final String TEMPLATE_ID_COMMENT = "模板ID";



    public static Category of(Object obj) {
        Category e = new Category();
        BeanUtils.copyProperties(obj, e);
        return e;
    }

    public static QueryWrapper<Category> queryWrapper(Object obj) {
        return new QueryWrapper<>(of(obj));
    }

}
